package ai.people.platform.graph.service;

import ai.people.netmon.framework.domain.graph.request.InsertRelationBatch;
import ai.people.netmon.framework.domain.graph.request.InsertRelationRequest;
import ai.people.netmon.framework.domain.graph.request.InsertRequest;
import ai.people.netmon.framework.domain.graph.request.InsertRequestBatch;
import com.vesoft.nebula.client.graph.exception.ClientServerIncompatibleException;
import com.vesoft.nebula.client.graph.exception.IOErrorException;

import java.io.UnsupportedEncodingException;

/**
 * @author zhenglin
 * @date 2022/5/13
 */
public interface GraphDataService {
    /**
     * 插入数据
     *
     * @param request 请求
     * @return {@link String}
     * @throws Exception 异常
     */
    String insert(InsertRequest request) throws Exception;

    /**
     * 插入数据(带有关系)
     *
     * @param request 请求
     */
    void insertWithEdge(InsertRelationRequest request) throws Exception;

    /**
     * 批量保存
     *
     * @param insertRequest 插入请求
     * @return boolean
     */
    boolean batchSave(InsertRequestBatch insertRequest) throws ClientServerIncompatibleException, IOErrorException, UnsupportedEncodingException;

    /**
     * 批量保存(带有关系)
     *
     * @param insertRequest 插入请求
     * @return boolean
     */
    boolean batchSaveWithEdge(InsertRelationBatch insertRequest) throws ClientServerIncompatibleException, IOErrorException, UnsupportedEncodingException;
}
